package day9;

/**
 * @author oldliu
 * @since 1.0
 */
//存钱的
public class Depositer extends Thread {
    private final Accout ac;

    public Depositer(String n, Accout ac){
       super(n);
       this.ac=ac;
   }

    @Override
    public void run() {
        while (true){
             ac.deposit(1500);
            try {
                synchronized (ac){
                    ac.notifyAll();//上锁
                }
                Thread.sleep(6000);//故意等待6秒
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
